#ifndef QSERVERUPDATE_H
#define QSERVERUPDATE_H

#include "../devicelibglobal.h"
#include "../qbasedefine.h"

#include <QDateTime>
#include <QObject>
#include <QTimer>

class QDeviceServer;

class DEVICELIB_EXPORT QServerUpdate : public QObject
{
    Q_OBJECT
public:
    explicit QServerUpdate(QDeviceServer* server,QObject *parent = 0);
    ~QServerUpdate();

    int    update(const QByteArray &data,tagDeviceInfo* info);
protected:
    void clear();
signals:
    void    failed();
    void    success();
    void    offline();
    void    position(int pos);
protected slots:
    void timer();
    void    recv(const QByteArray& data);
signals:
    
public slots:
protected:
    QDeviceServer       *m_device_server;
    QList<QByteArray>   m_send_data;
    tagDeviceInfo       m_device_info;
    int                 m_failed_times;
    QDateTime           m_last_time;
    QTimer              *m_timer;
    bool                m_is_updating;
    int                 m_position;
};

#endif // QSERVERUPDATE_H
